package com.ewili.x.special.init;

import com.ewili.framework.service.inter.MailService;
import com.ewili.x.special.service.data.inter.*;
import com.ewili.x.special.service.strategy.inter.StrategyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @author pangkunkun
 * @date 2017/9/3
 * 这里通过设定value的值来指定执行顺序
 */
@Component
@Order(value = 1)
@Slf4j
public class MyApplicationRunner implements ApplicationRunner {

    @Autowired
    private StockService stockService;

    @Autowired
    private HisRecordService hisRecordService;

    @Autowired
    private StrategyService strategyService;

    @Autowired
    private LeanToValueService leanToValueService;

    @Autowired
    private TradableShareHoldersService tradableShareHoldersService;

    @Autowired
    private MailService mailService;

    @Autowired
    private ExecsService execsService;

    @Autowired
    private ValueService valueService;

    @Autowired
    private ResearchReportService researchReportService;

    @Autowired
    private BlockTradingMarketService blockTradingMarketService;

    @Autowired
    private ExecsMarketService execsMarketService;

    @Autowired
    private BaiduEventService baiduEventService;

    @Autowired
    private AmountStockService amountStockService;

    @Autowired
    private GoodWillService goodWillService;

    @Autowired
    private HyRankService hyRankService;

    @Autowired
    private AnalysisService analysisService;

    @Autowired
    private SurveyStatService surveyStatService;

    @Autowired
    private FinanceNoticeService financeNoticeService;

    @Autowired
    private ThemeService themeService;

    @Autowired
    private ThemeStockService themeStockService;

    @Override
    public void run(ApplicationArguments args) {

        //https://guba.eastmoney.com/rank/ 人气排行
        //http://data.eastmoney.com/executive/gdzjc-jzc.html 股东增减持数据
        //http://data.eastmoney.com/bbsj/yjbb/000606.html; 财务数据
        //http://data.eastmoney.com/DataCenter_V3/gdzjc.ashx?pagesize=50&page=1&js=var%20uzoftlkq&param=&sortRule=1&sortType=NOTICEDATE&tabid=all&code=&name=&rt=52238572 股东增减持
        //机构调研统计
        //http://datainterface3.eastmoney.com/EM_DataCenter_V3/api/JGDYHZ/GetJGDYMX?js=datatable5016609&tkn=eastmoney&secuCode=&sortfield=0&sortdirec=1&pageNum=1&pageSize=50&cfg=jgdyhz&p=1&pageNo=1&_=1605666197514
        //机构调研明细
        //http://datainterface3.eastmoney.com/EM_DataCenter_V3/api/JGDYMX/GetJGDYMX?js=datatable8247724&tkn=eastmoney&secuCode=&dateTime=&sortfield=0&sortdirec=1&pageNum=2&pageSize=50&cfg=jgdymx&p=2&pageNo=2&_=1605666366955


        //股票数据
        //log.info("stockCode spide start");
        stockService.spideStock();
        //log.info("stockCode spide end");

        //十大股东增减持，按季度计算
        //log.info("EastMoneyTradableHolder spide start");
        tradableShareHoldersService.spideEastMoneyTradableHolder();
        //log.info("EastMoneyTradableHolder spide end");

        // 个股研究报告
        researchReportService.spideResearchReport();

        //股票资金
        amountStockService.spide();
        amountStockService.spideThreeDaysAmountAddRate();

        //surveyStatService.spide();

        //股权质押比率
        //leanToValueService.spide();

        //商誉
        //goodWillService.spideGoodWill();

        // 高管增减持
        //log.info("execs spide start");
        //execsService.spideExecs();
        //log.info("execs spide end");

        //历史交易记录
        hisRecordService.spideHisRecord();
        hisRecordService.spideAdj();

        //估值数据
        valueService.spideValueStock();

        //业绩预告
        financeNoticeService.spideFinanceNotice();

        //行业对比
        //hyRankService.spideData();

        //东方财富题材
        themeService.spideEastMoneyTheme();

        //题材关联个股
        themeStockService.spide();

        System.exit(0);
    }
}
